<template>
	<lb-tabbar ref="tabbar" :value="active" >
		<lb-tabbar-item v-for="item in tabbars" :key="item.name" :name="item.name" :icon="active === item.name ? item.iconActive : item.icon"
		 :dot="item.dot" :info="item.info" :raisede="item.raisede" @click="handleTabbarItemClick">
			{{ item.text }}
		</lb-tabbar-item>
	</lb-tabbar>
</template>

<script>
	export default {
		data() {
			return {
			}
		},

		methods: {
			handleTabbarItemClick(e) {
				const name = e.name
				// if (name === 'plus') {
				// 	uni.showToast({
				// 		title: '发布',
				// 		icon: 'none'
				// 	})
				// } else {
					const tabbar = this.$store.state.tabbars.find(item => item.name === name)
					uni.switchTab({
						url: tabbar.path,
						success: () => {
							// 切换后重新设置，因为不在在触发页面的created生命周期
							// this.SET_ACTIVE(name)
							 this.$u.vuex('active', name);
						}
					})
				// }
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>
